﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static Sunny.UI.UITextBox;

namespace SprayProcessSCADASystem.UserControls
{
    public partial class UserSetValue : UserControl
    {
        public UserSetValue()
        {
            InitializeComponent();
        }


        #region 设备变量名

        private string _deviceVarName = "名称";

        [Description("设备变量名称")]
        [Category("自定义属性")]
        [Browsable(true)]
        public string DeviceVarName
        {
            get { return _deviceVarName; }
            set
            {
                _deviceVarName = value;
                this.lbl_paramName.Text = _deviceVarName;
            }
        }

        #endregion


        #region 设备变量值

        private string _varValue = "";
        [Description("变量值")]
        [Category("自定义属性")]
        [Browsable(true)]
        public string VarValue
        {
            get { return _varValue; }
            set
            {
                _varValue = value;
                this.txt_value.Text = _varValue;
            }
        }

        private UIEditType _dataType = UIEditType.Double;
        [Browsable(true)]
        [Category("自定义属性")]
        [Description("数值类型")]
        public UIEditType DataType
        {
            get { return _dataType; }
            set
            {
                _dataType = value;
                this.txt_value.Type = _dataType;
            }
        }


        #endregion

        #region 设备变量单位

        private string _unit = "单位";
        [Description("设置或获取单位")]
        [Category("自定义属性")]
        [Browsable(true)]
        public string Unit
        {
            get { return _unit; }
            set
            {
                _unit = value;
                this.lbl_unit.Text = _unit;
            }
        }

        #endregion

        private void txt_Value_TextChanged(object sender, EventArgs e)
        {
            VarValue = this.txt_value.Text;
        }
        private string _variableName = "";

        [Browsable(true)]
        [Category("自定义属性")]
        [Description("获取变量名称")]
        public string VariableName
        {
            get { return _variableName; }
            set { _variableName = value; }
        }
    }
}
